package com.wjf.concurrency.example.singleton;

import com.wjf.concurrency.annoations.ThreadSafe;

/*
* 饿汉模式
* 单例实例在类装载时进行创建
* */
@ThreadSafe
public class SingletonExample2 {

    //私有的构造函数
    private SingletonExample2(){

    }
    //单例对象
    public static SingletonExample2 intance=new SingletonExample2();

    //静态的工厂方法
    public static SingletonExample2 getInstance(){
        return intance;
    }
}
